<!DOCTYPE html>
<html lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="description" content="上海大学开源镜像站，致力于为上大校内提供高质量的开源软件镜像、Linux镜像源服务，帮助校内用户更方便地获取开源软件。本镜像站由上海大学开源社区负责维护">
    <meta name="keywords" content="镜像站,镜像源,Linux,开源,软件源"> 
    <meta name="author" content="SHUOSC">
    <title>上海大学开源镜像站</title>
    <link href="/src/element-ui.css" rel="stylesheet">
    <link href="/src/mirrors.css" rel="stylesheet">
    <link rel="shortcut icon" href="/favicon.ico">
</head>

<body>
    <div id="menu">
        <div class="container">
        <el-menu :default-active="activeIndex" mode="horizontal" >
            <div class="title">上海大学开源镜像站</div>
            <div class="navBar">
                <el-menu-item index="7"><a href="https://osc.shu.edu.cn">Home</a></el-menu-item>
                <el-menu-item index="2"><a href="/news">News</a></el-menu-item>
                <el-menu-item index="3"><a href="/status.html">Status</a></el-menu-item>
                <el-menu-item index="4"><a href="/help">Help</a></el-menu-item>
                <el-menu-item index="5"><a href="/news/atom.xml">RSS</a></el-menu-item>
                <el-menu-item index="6"><a href="/">Mirrors</a></el-menu-item>
            </div>
            <div class="clear"></div>
        </el-menu>
        </div>
    </div>
    <div class="container">
        <div class="left">
            <div id="mirrors-list">
                <div class="bar">
                    <div class="title">源列表</div>
                    <el-input v-model="search" placeholder="输入关键词筛选镜像" class="search"></el-input>
                    <template>
                        <el-table :data="searchData" v-loading="loading" stripe style="width: 100%" v-if="isAll">
                            <el-table-column prop="name" label="镜像名" min-width="35%">
                                <template scope="scope">
                                    <a v-bind:href="[scope.row.url]">{{scope.row.name}}</a>
                                    <span class="official" v-if="scope.row.official">官方</span>
                                    <span class="new" v-if="scope.row.isNew">新</span>
                                </template>
                            </el-table-column>
                            <el-table-column prop="updateTime" label="最近一次同步完成时间" min-width="25%">
                                <template scope="scope">
                                            <div v-if="scope.row.updateTime == ''">Unknow</div>
                                            <div v-else>{{scope.row.updateTime}}</div>
                                        </template>
                            </el-table-column>
                            <el-table-column prop="taskStatus" label="同步状态" min-width="15%">
                                <template scope="scope">
                                    <el-tag v-if="scope.row.taskStatus == '1'" type="warning">正在同步</el-tag>
                                    <el-tag v-else-if="scope.row.taskStatus == '0'" type="primary">尚未同步</el-tag>
                                    <el-tag v-else-if="scope.row.taskStatus == '2'&&scope.row.exitcode == '0'" type="success">同步完成</el-tag>
                                    <el-tag v-else-if="scope.row.taskStatus == '2'&&scope.row.exitcode == '1'" type="success">同步完成</el-tag>
                                    <el-tag v-else-if="scope.row.taskStatus == '2'&&scope.row.exitcode == '4'" type="success">同步完成</el-tag>
                                    <el-tag v-else-if="scope.row.taskStatus == '2'&&scope.row.exitcode == '8'" type="success">同步完成</el-tag>
                                    <el-tag v-else type="danger">同步出错</el-tag>
                                </template>
                            </el-table-column>
                            <el-table-column prop="help" label="帮助" min-width="15%">
                                <template scope="scope">
                                            <a v-if="scope.row.help !== ''" :href="scope.row.help" target="_blank">Help</a>
                                        </template>
                            </el-table-column>
                        </el-table>
                        <el-table :data="searchData" v-loading="loading" stripe style="width: 100%" v-else>
                            <el-table-column prop="name" label="镜像名" min-width="30%">
                                <template scope="scope">
                                    <a v-bind:href="[scope.row.url]">{{scope.row.name}}</a>
                                    <span class="official" v-if="scope.row.official">官方</span>
                                    <span class="new" v-if="scope.row.isNew">新</span>
                                </template>
                            </el-table-column>
                            <el-table-column prop="taskStatus" label="同步状态" min-width="18%">
                                <template scope="scope">
                                    <el-tag v-if="scope.row.taskStatus == '1'" type="warning">正在同步</el-tag>
                                    <el-tag v-else-if="scope.row.taskStatus == '0'" type="primary">尚未同步</el-tag>
                                    <el-tag v-else-if="scope.row.taskStatus == '2'&&scope.row.exitcode == '0'" type="success">同步完成</el-tag>
                                    <el-tag v-else-if="scope.row.taskStatus == '2'&&scope.row.exitcode == '1'" type="success">同步完成</el-tag>
                                    <el-tag v-else-if="scope.row.taskStatus == '2'&&scope.row.exitcode == '4'" type="success">同步完成</el-tag>
                                    <el-tag v-else-if="scope.row.taskStatus == '2'&&scope.row.exitcode == '8'" type="success">同步完成</el-tag>
                                    <el-tag v-else type="danger">同步出错</el-tag>
                                </template>
                            </el-table-column>
                            <el-table-column prop="help" label="" min-width="5%">
                                <template scope="scope">
                                    <a v-if="scope.row.help !== ''" :href="scope.row.help" target="_blank"><i class="el-icon-info"></i></a>
                                </template>
                            </el-table-column>
                        </el-table>
                    </template>
                </div>
            </div>
        </div>
        <div class="right">
            <div id="news">
                <div class="container">
                    <div class="bar">
                        <div class="title">镜像站通知</div>
                        <p v-if="isNull" v-cloak>暂无通知</p>
                        <div v-else id="news-lists">
                            <p v-for="item in items" v-cloak>
                                <span class="new" v-if="item.day<3">新</span>
                                <a :href="item.url" v-text="item.title"><a>
                            </p>
                        </div>
                    </div>                    
                </div>
            </div>
            <div id="domains">
                <div class="container">
                    <div class="bar">
                        <div class="title">域名选择</div>
                        <p v-for="domain in domains"><a :href="domain.url"  v-text="domain.url"></a>{{domain.title}}</p>
                    </div>
                </div>
            </div>
            <div id="isos">
                <div class="container">
                    <div class="bar">
                        <div class="title">获取发行版</div>
                        <p>常用Linux发行版ISO和应用软件安装包快捷下载</p>
                        <el-button type="info" icon="el-icon-download" @click="centerDialogVisible = true">获取下载链接</el-button>
                        <el-dialog  title="获取发行版" min-width="100%" :visible.sync="centerDialogVisible"  width="35%" center modal="true">
                            <template>
                                <el-select v-model="linux" placeholder="请选择发行版类型" @change="changeReleases">
                                    <el-option v-for="item in isos" :key="item.value" :label="item.label" :value="item.value">
                                    </el-option>
                                </el-select>
                                <el-select v-model="url" placeholder="请选择版本号" @change="generateUrl">
                                    <el-option v-for="item in releases"  :key="item.value" :label="item.label" :value="item.value">	
                                    </el-option>
                                </el-select>
                                <a v-if="download" :href="url"><el-button type="info" icon="el-icon-download">下载</el-button></a>
                            </template>
                        </el-dialog>
                    </div>            
                </div>
            </div>
			<div id="links">
                <div class="container">
                    <div class="bar">
                        <div class="title">常用链接</div>
                        <p v-for="link in links"><a :href="link.url"  v-text="link.title"></a></p>
                        <a href='http://ipv6-test.com/validate.php?url=referer'><img src='/button-ipv6-80x15.png' alt='ipv6 ready' title='ipv6 ready' border='0' /></a>
                        <a class="github-button" href="https://github.com/shuopensourcecommunity/mirrors.shuosc.org" data-show-count="true" aria-label="Star shuopensourcecommunity/mirrors.shuosc.org on GitHub">Star</a>
                        <!-- IPv6-test.com widget BEGIN -->
                        <script type="text/javascript">var _ipv6test_widget_style = {
                            border: "solid 1px #000",
                            font_size: "12px",
                            show_country_flags: true,
                            show_loading_anim: true,
                            ipv4_label_color: "#393",
                            ipv4_background_color: "#eee",
                            ipv6_label_color: "#339",
                            ipv6_background_color: "#ddd",
                            stats_position: "bottom",
                            stats_font_size: "10px",
                            stats_color: "#eee",
                            stats_color_v4: "#beb",
                            stats_color_v6: "#bbe",
                            stats_background_color: "#666"
                            }
                        </script>
                        <div id="_ipv6test_widget" style="max-width:30em;display:none">loading <a href="http://ipv6-test.com/">IPv6 connection test</a> ...</div> 
                    </div>
                </div>
            </div>
			<div id="others">
				<div class="container">
					<div class="bar">
						<div class="title">友情链接</div>
						<p v-for="link in links"><a :href="link.url"  v-text="link.title"></a></p>
					</div>
				</div>
			</div>
        </div>
        <div class="clear"></div> 
    </div>
    <div id="copyright">
        <div class="container">
            <div class="content">
                <p>上海大学开源镜像站是由<a href="http://www.its.shu.edu.cn" target="_blank">上海大学信息化办公室</a>提供基础设施支持，由<a href="https://nita.shu.edu.cn" target="_blank">上海大学NITA实验室</a>提供服务器支持，由<a href="https://osc.shu.edu.cn" target="_blank">上海大学开源社区</a>负责管理维护。本站所有源均可通过HTTP、FTP和RSYNC方式访问，RSYNC的访问模块名为源的HTTP子目录名。</p>
                <p>上海大学开源社区（SHU Open Source Community）是由上海大学的开源技术爱好者于 2010 年自主发起成立的非营利性学生组织。上海大学开源社区的宗旨是：面向全校师生传播开源理念、分享技术知识；为上海大学的开源技术爱好者提供公共服务，建立开放友好的技术交流平台；弘扬自由软件精神，培养自由软件社区文化氛围，为开源事业做出贡献。    </p>
            </div>
            <div class="logo">上海大学开源社区</div>
            <div class="clear"></div>
        </div>
    </div>
    <script src="/src/vue.min.js"></script>
    <script src="/src/element-ui.js"></script>
    <script src="/src/axios.js"></script>
    <script src="/src/mirrors.js"></script>
    <script type="text/javascript" src="/src/ip.js?domain=referer" async="async"></script>
    <script async defer src="https://buttons.github.io/buttons.js"></script>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-113238974-4"></script>
    <script>
	  window.dataLayer = window.dataLayer || [];
	  function gtag(){dataLayer.push(arguments);}
	  gtag('js', new Date());
	  gtag('config', 'UA-113238974-4');
    </script>
    
    <script>
        
        var menu = new Vue({
            el: '#menu',
            data: {
                activeIndex: '1'
            }
        })
        var mirrors = new Vue({
            el: '#mirrors-list',
            data: {
                search: '',
                items: [],
                isAll: true,
                loading: true,
            },
            created: function() {
                this.loadMirrors();
            },
            methods: {
                loadMirrors: function () {
                    axios.get('/data/mirrors.json')
                    .then(function (response) {
                        mirrors.items = response.data.mirrors;
                    });
                    axios.get('/data/task_status.json')
                    .then(function (response) {
                        for(item of mirrors.items){
                            var name = item.name;
                            var data = response.data[name];
                            var date = new Date();
                            if(date.getHours()>=2){
                                item.updateTime = showTime(0)+" 02:00:00";
                            }else{
                                item.updateTime = showTime(-1)+" 02:00:00";
                            }
                            if(typeof(data['exitcode'])!= "undefined"){
                                item.exitcode = data['exitcode'];
                            }
                                item.taskStatus = "2";
                                item.exitcode = "0";
                            console.log(item);
                            if(typeof(data['upstream'])!= "undefined"){
                                item.sources = data['upstream'];
                            }
                        }
                    });
                    var clientWidth = document.documentElement.clientWidth;
                    if(clientWidth<768){
                        this.isAll = false;
                    }
                    this.loading = false;
                }
            },
            computed: {
                searchData: function() {
                    var search = this.search;
                    var vm = this;
                    if (search) {
                        return this.items.filter(function(item) {
                            return Object.keys(item).some(function(key) {
                                return String(item[key]).toLowerCase().indexOf(search) > -1
                            })
                        })
                    }
                    vm.items = vm.items.sort(function(x, y) {
                        return x.name.localeCompare(y.name);
                    });
                    return vm.items;
                }
            }
        })
        var isos = new Vue({
            el: '#isos',
            data: {
                selectedOptions: [],
                linux: '',
                releases: '',
                url: '',
                download: false,
                isos: [],
                centerDialogVisible: false
            },
            created: function() {
                this.loadIsos();
            },
            methods:{
                loadIsos: function () {
                    axios.get('/data/mirrors.json')
                    .then(function (response) {
                        isos.isos = response.data.isos;    
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },
                changeReleases: function() {
                    for(var item of this.isos) {
                        if(item.value == this.linux){
                            this.releases = item.children;					
                        }		
                    }
                    document.getElementsByClassName('el-input__inner')[2].value = '';
                    this.download = false;
                },
                generateUrl: function(){
                    this.download = true;
                }
            }
        })

        var news = new Vue({
            el: '#news',
            data: {
                isNull: true,
                items: []   
            },
            created: function() {
                this.loadNews();
            },
            methods: {
                loadNews: function () {
                    var vm = this;
                    axios.get('/news/recent.json')
                    .then(function (response) {
                        if(response.data!==null){
                            vm.isNull = false;
                            vm.items = response.data;
                            for(var item of vm.items){
                                item.url = "/news/p/"+item.abbrlink+".html";
                                s1 = new Date(item.date.slice(0,10).replace(/-/g, "/"));
                                s2 = new Date();
                                var days = s2.getTime() - s1.getTime();
                                item.day = parseInt(days / (1000 * 60 * 60 * 24));
                            }
                        }                   
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                }
            }
        })
        var domains = new Vue({
            el: '#domains',
            data: {
                domains:[{
                    title: '自动解析',
                    url: 'https://mirrors.shuosc.org'
                },{
                    title: '只解析IPv4',
                    url: 'https://mirrors.shu.edu.cn'
                },{
                    title: '只解析IPv6',
                    url: 'https://mirrors.shu6.edu.cn'
                }]   
            }
        })
        var links = new Vue({
            el: '#links',
            data: {
                links:[{
                    title: '系统状态 / Status',
                    url: '/status.html'
                },{
                    title: '访问监控 / Visitor',
                    url: '/visitor'
                },{
                    title: '镜像通知 / News',
                    url: '/news'
                },{
                    title: 'OSC@SHU',
                    url: 'https://osc.shu.edu.cn'
                },{
                    title: 'Github',
                    url: 'https://github.com/shuopensourcecommunity'
                },{
                    title: '提交问题或建议',
                    url: 'https://github.com/shuopensourcecommunity/mirrors.shuosc.org/issues/new'
                },{
                    title: 'SHUhelper',
                    url: 'https://www.shuhelper.cn'
                },{
                    title: 'Git@SHUOSC',
                    url: 'https://git.shuosc.org'
                },{
                    title: '上大导航 / LINK',
                    url: 'https://shuer.link'
                },{
                    title: '社区维基 / Wiki',
                    url: 'https://wiki.shuosc.org'
                },{
                    title: '在线交流 / Telegram',
                    url: 'https://t.me/joinchat/ErK1eQ6s9-axpVr75Oiwww'
                }]   
            }
        })
		var others = new Vue({
			el: '#others',
			data : {
				links:[{
					title: '清华大学TUNA开源镜像站',
					url: 'https://mirrors.tuna.tsinghua.edu.cn'
				}, {
                    title: '中国科学技术大学开源镜像站',
                    url: 'https://mirrors.ustc.edu.cn'
                }, {
                    title: '上海交通大学开源镜像站',
                    url: 'https://ftp.sjtu.edu.cn'
                }, {
                    title: '上海科技大学开源镜像站',
                    url: 'https://mirrors.geekpie.org'
                }, {
                    title: '浙江大学开源镜像站',
                    url: 'https://mirrors.zju.edu.cn'
                }, {
                    title: '兰州大学开源镜像站',
                    url: 'https://mirror.lzu.edu.cn'
                }, {
                    title: '华中科技大学开源镜像站',
                    url: 'http://mirrors.hust.edu.cn'
                }, {
                    title: '东软信息学院开源镜像站',
                    url: 'https://mirrors.neusoft.edu.cn/'
                }, {
                    title: '北京理工大学开源镜像站',
                    url: 'http://mirror.bit.edu.cn'
                }]
			}
		})
    </script>
</body>

</html>
